﻿using System;
using System.Windows.Forms;
using UI.Properties;

namespace UI
{
    public partial class TaskPanel : Form
    {
        public TaskPanel()
        {
            InitializeComponent();
            LoadSetting();
        }
        /// <summary>
        /// 加载设置到设置面板
        /// </summary>
        public void LoadSetting()
        {
            TextBooksURL.Text = Settings.Default.BooksURL;
            TextBooksXPuth.Text = Settings.Default.BooksXPuth;
            TextChapterListXPuth.Text = Settings.Default.ChapterListXPuth;
            TextChapterContentXPuth.Text = Settings.Default.ChapterContentXPuth;
        }
        private void BtnSave_Click(object sender, EventArgs e)
        {
            try
            {
                Settings.Default.BooksURL = TextBooksURL.Text;
                Settings.Default.BooksXPuth = TextBooksXPuth.Text;
                Settings.Default.ChapterListXPuth = TextChapterListXPuth.Text;
                Settings.Default.ChapterContentXPuth = TextChapterContentXPuth.Text;


                Settings.Default.Save();
                MessageBox.Show("保存成功！");
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }

        private void BtnClose_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}
